package cc.monggo.web.controller.index;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import cc.monggo.common.AbstractBaseController;
import cc.monggo.common.Constants;
import cc.monggo.utils.EncrypTool;
import cc.monggo.web.form.IndexForm;

/**
 * 登陆首页
 * 
 * @author Administrator
 * 
 */
@Controller
@RequestMapping("/index")
public class IndexController extends AbstractBaseController {

	/**
	 * 登入首页
	 * 
	 * @return
	 * @throws Exception
	 */
	@RequestMapping
	public ModelAndView enter(HttpServletRequest request,
			HttpServletResponse response, IndexForm form) throws Exception {
		ModelAndView mv = new ModelAndView("index/index",Constants.FORM_COMMAND_KEY, form);	
		String userId = EncrypTool.dencode(StringUtils.trim(form.getSid()));	
		mv.addObject("success", "成功进入系统" + userId);
		return mv;
	}
	
	/**
	 * 登入首页
	 * 
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value="/map")
	public ModelAndView map(HttpServletRequest request,
			HttpServletResponse response, IndexForm form) throws Exception {
		ModelAndView mv = new ModelAndView("/map/map",Constants.FORM_COMMAND_KEY, form);	
		return mv;
	}
	
}








